﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace NutriLeaf.Web.Core.Height
{
    public class Converter
    {
        public static decimal Convert(decimal value, HeightUnits from, HeightUnits to)
        {
            if (from == to)
            {
                return value;
            }

            if (from == HeightUnits.Centimeters && to == HeightUnits.Inches)
            {
                return (decimal)(value * (decimal)0.3937);
            }

            if (from == HeightUnits.Inches && to == HeightUnits.Centimeters)
            {
                return (decimal)(value * (decimal)2.54);
            }
            return 0;
        }
    }
}